//
//  Helper.h
//  PalmKitchen
//
//  Created by apple on 14-10-14.
//  Copyright (c) 2014年 apple. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <Photos/Photos.h>

@class Helper;
//成功
typedef void (^YYLabelLookMore)();


@interface Helper : NSObject

+(UIButton *)createButton:(CGRect)frame title:(NSString *)title image:(UIImage *)image target:(id)target selector:(SEL)selector;
+(NSMutableAttributedString *)getAttributedStringWith:(NSString *)string andDic:(NSDictionary<NSAttributedStringKey, id> *)AttrDic range:(NSRange)range;
//字符串文字的长度和高度
+ (CGSize)sizeLabelWidth:(CGFloat)width andLines:(int )index andFont:(UIFont *)font attributedText:(NSAttributedString *)attributted;
+(CGRect)getTextFrameWithText:(NSString *)strContext withSize:(CGSize)size withFont:(UIFont * )font;
//字符串文字的长度
+(CGRect )getWidthWith:(int )index with:(UIFont *)font;
+(CGRect )getWidthWithString:(NSString* )string with:(UIFont *)font;
//富文本的长度宽度
+(CGRect)getTextFrameWithText:(NSString *)strContext withSize:(CGSize)size LabelSpeace:(CGFloat)lineSpeace withFont:(UIFont*)font;
//字符串文字的长度
+(CGFloat)widthOfString:(NSString *)string font:(UIFont*)font height:(CGFloat)height;
//+(CGFloat)heightWithfont:(int)font;
//字符串文字的高度
+(CGFloat)heightOfString:(NSString *)string font:(UIFont*)font width:(CGFloat)width;
+(CGFloat)heightWithfont:(int)font;
+(CGFloat)heightWithNum:(int)index font:(int)font;
//获取今天的日期：年月日
+(NSDictionary *)getTodayDate;

//邮箱
+ (BOOL) justEmail:(NSString *)email;

//手机号码验证
+ (BOOL) justMobile:(NSString *)mobile;

//车牌号验证
+ (BOOL) justCarNo:(NSString *)carNo;

//车型
+ (BOOL) justCarType:(NSString *)CarType;

//用户名
+ (BOOL) justUserName:(NSString *)name;
//数字
+ (BOOL) justTextIsInt:(NSString *)str;
//密码
+ (BOOL) justPassword:(NSString *)passWord;

//昵称
+ (BOOL) justNickname:(NSString *)nickname;

//身份证号
+ (BOOL) justIdentityCard: (NSString *)identityCard;
//判断内容是否全部为空格  yes 全部为空格  no 不是
+(BOOL) isEmpty:(NSString *) str ;
//获取字符串首字母(传入汉字字符串, 返回大写拼音首字母)
+(NSString *)getFirstLetterFromString:(NSString *)aString;
//图片处理
//返回窗口一样的图片
+(UIImage *)convertViewToImage;
//剪切uiimageView生成图片
+(UIImage *)getShearImageViewToImage:(CGRect)frame image:(NSString*)imgStr;
//创建纯颜色图片
+(UIImage *)creatImageFromColor:(UIColor *)color with:(CGSize)mySize;
//拉伸图片
+(UIImage *)resizebleImageWithString:(NSString *)imgStr;
+(UIImage *)resizebleImageWithImage:(UIImage *)newImg;
+(UIImage *)compressOriginalImage:(UIImage *)image toSize:(CGSize)size;

+(UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size;
/**
 *  重新绘制图片
 *
 *  @param color 填充色
 *
 *  @return UIImage
 */
+(UIImage *)imageChange:(UIImage *)image WithColor:(UIColor *)color;
//键盘上面加完成
+(UIToolbar *)addToolbar;
//识别二维码
+ (NSArray *)readQRCodeFromImage:(UIImage *)image;
//处理乱码
+(NSString *)ToDealWithCode:(NSString *)string;
+(UIImage *)getScaleToSize:(UIImage *)img size:(CGSize)size;
+(UIImage *)clipImage:(UIImage *)image toRect:(CGSize)size;

/** 添加更多 */
//+(void)addSeeMoreButton:(YYLabel *)label andLookMoreBlock:(YYLabelLookMore)block;
/** 打开手电筒 */
+ (void)openFlashlight;
/** 关闭手电筒 */
+ (void)closeFlashlight;
+(void)palySoundName:(int)nameNum;
/*小数点后两位，或整数 */
+(NSString *)getNewStringWith:(NSString *)str;

+ (BOOL)isCameraDenied;
+ (BOOL)isCameraNotDetermined;

+ (BOOL)isPhotoAlbumDenied;
+ (BOOL)isPhotoAlbumNotDetermined;
+ (void)creatPhotoAlbumToSaveImage:(UIImage *)image;
@end


